package com.kefu.call.vo;

import javax.validation.constraints.Size;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;
import com.kefu.call.model.CallGateway;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author CodeGenerator
 * @date 2022/07/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "网关表")
public class CallGatewayUpdateVo extends AbstractUpdateVo<CallGateway,String> {

    @NotEmpty
    @ApiModelProperty(value = "主键")
    private String fOid;
    @ApiModelProperty(value = "名称",hidden = true)
    private String name;
    @ApiModelProperty(value = "注册的地址")
    private String realm;
    @ApiModelProperty(value = "是否注册【true或false】")
    private String register;
    @ApiModelProperty(value = "发件人字段中使用的用户名如果为空，则默认为用户名")
    private String fromuser;
    @ApiModelProperty(value = "并发数量")
    private Integer concurrent;
    @ApiModelProperty(value = "注册用户名")
    private String username;
    @ApiModelProperty(value = "密码")
    private String password;
    @ApiModelProperty(value = "验证用户名")
    private String authusername;
    @ApiModelProperty(value = "显示在from中的名称")
    private String calleridinfrom;
    @ApiModelProperty(value = "联系分机")
    private String extension;
    @ApiModelProperty(value = "SIP联系人头中发送分机")
    private String extensionincontact;
    @ApiModelProperty(value = "代理")
    private String proxy;
    @ApiModelProperty(value = "联系地址")
    private String context;
    @ApiModelProperty(value = "注册秒，默认3600")
    private String expireseconds;
    @ApiModelProperty(value = "重试注册的秒数")
    private String retryseconds;
    @ApiModelProperty(value = "发件人用户")
    private String fromdomain;
    @ApiModelProperty(value = "from字段中使用的域")
    private String registerproxy;
    @ApiModelProperty(value = "注册的代理")
    private String contactparams;
    @ApiModelProperty(value = "寄存器传输【如果已启用，则为udp，tcp或tls】")
    private String registertransport;
    @ApiModelProperty(value = "名称")
    private String memo;
//    @ApiModelProperty(value = "驱动[profile]id")
//    private String profileoid;
    @ApiModelProperty(value = "公司ID")
    private String company;
    @ApiModelProperty(value = "是否启用")
    private Integer enablegw;
    @ApiModelProperty(value = "归属")
    private String gs;
    @ApiModelProperty(value = "区号")
    private String qh;
//    @ApiModelProperty(value = "免费通话时间[本月]")
//    private String rentalminute;
    @ApiModelProperty(value = "当月套餐")
    private Integer setmealoid;
    @ApiModelProperty(value = "下次同步时间",hidden = true)
    private String synctime;
    @ApiModelProperty(value = "下月生效套餐")
    private Integer setmealoidU;
//    @ApiModelProperty(value = "消费[本月]")
//    private String consumption;
    @ApiModelProperty(value = "被叫前缀")
    private String callprefix;

    @Override
    public CallGateway convert() {
        CallGateway info = new CallGateway();
        info.setName(name);
        info.setRealm(realm);
        info.setRegister(register);
        info.setFromuser(fromuser);
        info.setConcurrent(concurrent);
        info.setUsername(username);
        info.setPassword(password);
        info.setAuthusername(authusername);
        info.setCalleridinfrom(calleridinfrom);
        info.setExtension(extension);
        info.setExtensionincontact(extensionincontact);
        info.setProxy(proxy);
        info.setContext(context);
        info.setExpireseconds(expireseconds);
        info.setRetryseconds(retryseconds);
        info.setFromdomain(fromdomain);
        info.setRegisterproxy(registerproxy);
        info.setContactparams(contactparams);
        info.setRegistertransport(registertransport);
        info.setMemo(memo);
//        info.setProfileoid(profileoid);
        info.setCompany(company);
        info.setEnablegw(enablegw);
        info.setGs(gs);
        info.setQh(qh);
//        info.setRentalminute(rentalminute);
        info.setSetmealoid(setmealoid);
        info.setSynctime(synctime);
        info.setSetmealoidU(setmealoidU);
//        info.setConsumption(consumption);
        KefuContext context = KefuContext.getKefuContext();
        info.setFOid(fOid);
        info.setCallprefix(callprefix);
        return info;
	}
}